﻿namespace OneWorks.Utils.Log
{
    using log4net;
    using Configuration;
    using System.Configuration;
    using log4net.Config;
    using System.IO;

    public class LogHandler
    {
        public static readonly ILog Log;

        static LogHandler()
        {

            LogSection section = ConfigurationManager.GetSection("Log4NetConfig") as LogSection;
            if (section != null)
            {
                FileInfo file = new FileInfo(section.Path);
                if (file.Exists)
                {
                    XmlConfigurator.Configure(file);
                }
            }
            if (Log == null)
                Log = LogManager.GetLogger(typeof(LogHandler));
        }
    }
}
